package c.x.jy.wexin.controller;

import c.x.jy.common.utils.PageUtils;
import c.x.jy.common.utils.R;
import c.x.jy.dao.entity.QuicktestypeEntity;
import c.x.jy.service.service.QuicktestypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


/**
 * 闪测类型表
 *
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-05-25 11:29:53
 */
@RestController
@RequestMapping("wechat/quicktestype")
public class QuicktestypeController {
    @Autowired
    private QuicktestypeService quicktestypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = quicktestypeService.queryPage(params);
       List<QuicktestypeEntity> list = quicktestypeService.list();
        return R.put(list);
    }

    @RequestMapping("/hotlist")
    public R hotlist(){
        List<QuicktestypeEntity> list = quicktestypeService.hotlist();
        return R.put(list);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		QuicktestypeEntity quicktestype = quicktestypeService.getById(id);

        return R.put(quicktestype);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("business:quicktestype:save")
    public R save(@RequestBody QuicktestypeEntity quicktestype){
		quicktestypeService.save(quicktestype);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("business:quicktestype:update")
    public R update(@RequestBody QuicktestypeEntity quicktestype){
		quicktestypeService.updateById(quicktestype);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete/{id}")
    @RequiresPermissions("business:quicktestype:delete")
    public R delete(@PathVariable("id") Long id){
		quicktestypeService.removeByIds(Arrays.asList(id));

        return R.ok();
    }

}

